﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Simple" targetNamespace="http://dzonny.cz/xml/DictionarySimple" elementFormDefault="qualified" xmlns="http://dzonny.cz/xml/DictionarySimple" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:annotation>
        <xs:documentation>
            This is schema of so-called simple dictionary used by ĐŘječnik dictionary engine
            to import dictionary from sources that contain translation pairs.
            See http://codeplex.com/DjRjecnik for details.
            
            The root element of this schema should be &lt;Dictionary&gt; (see end of file).
            
            Simple type of dictionary should be used for import only in rare cases
            because simple type represents whole dictionary as list of pairs of words 
            with possible references between words but with nothing like indexing.
            So, there can be many duplicates that must be resolved and merged during import.
            It makes import quite time-lasting.
        </xs:documentation>
    </xs:annotation>
    <!--Simple types-->
    <xs:simpleType name="lngcode">
        <xs:annotation>
            <xs:documentation>2- or 3- characters code of language accoring to ISO 639</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:pattern value="[a-z][a-z][a-z]?" />
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="version">
        <xs:annotation>
            <xs:documentation>version string constisting of 2 or 3 or 4 dot-separated numbers</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:pattern value="(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))(\.(0|([1-9][0-9]*)))?(\.(0|([1-9][0-9]*)))?" />
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="relation">
        <xs:annotation>
            <xs:documentation>word relation</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="seealso">
                <xs:annotation>
                    <xs:documentation>See-also word (word with similar meaning like current)</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="phrase">
                <xs:annotation>
                    <xs:documentation>A phrase related to this word</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="wordtype">
        <xs:annotation>
            <xs:documentation>gramatical types of words</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="noun">
                <xs:annotation>
                    <xs:documentation>noun substantive</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="adj">
                <xs:annotation>
                    <xs:documentation>adjective</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="pron">
                <xs:annotation>
                    <xs:documentation>pronoun</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="num">
                <xs:annotation>
                    <xs:documentation>numeral</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="verb">
                <xs:annotation>
                    <xs:documentation>verb</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="adv">
                <xs:annotation>
                    <xs:documentation>adverb</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="prep">
                <xs:annotation>
                    <xs:documentation>preposition</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="conj">
                <xs:annotation>
                    <xs:documentation>conjuction</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="part">
                <xs:annotation>
                    <xs:documentation>particle</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="intj">
                <xs:annotation>
                    <xs:documentation>interjection</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="phrase">
                <xs:annotation>
                    <xs:documentation>more words</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="art">
                <xs:annotation>
                    <xs:documentation>article</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>
    <!--Complex types-->
    <xs:element name="info">
        <xs:annotation>
            <xs:documentation>Informations about dictionary</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence minOccurs="1" maxOccurs="1">
                <xs:sequence minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>If specified the dictionary is treated as primary dictionary of given language combination</xs:documentation>
                    </xs:annotation>
                    <xs:element name="Primary">
                        <xs:complexType>
                            <xs:attribute name="ICO1" type="xs:string" use="required">
                                <xs:annotation>
                                    <xs:documentation>Filename icon (flag) of first language</xs:documentation>
                                </xs:annotation>
                            </xs:attribute>
                            <xs:attribute name="ICO2" type="xs:string" use="required">
                                <xs:annotation>
                                    <xs:documentation>Filename icon (flag) of second language</xs:documentation>
                                </xs:annotation>
                            </xs:attribute>
                        </xs:complexType>
                    </xs:element>
                </xs:sequence>
                <xs:element name="author" type="author" minOccurs="1" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>Information about author of dictionary - this is information about author of this XML file</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="original" type="OriginalAuthor" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>Information about original author of dictionary data (if differs from author of XML file)</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="note" type="xs:token" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>Dictionary note</xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:sequence>
            <xs:attribute name="Lang1Code" type="lngcode" use="required">
                <xs:annotation>
                    <xs:documentation>Code of first language</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="Lang2Code" type="lngcode" use="required">
                <xs:annotation>
                    <xs:documentation>Code of second language</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="Native1" type="xs:token" use="required">
                <xs:annotation>
                    <xs:documentation>Name of first language in first language</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="Native2" type="xs:token" use="required">
                <xs:annotation>
                    <xs:documentation>Name of second language in second language</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="Other1" type="xs:token" use="required">
                <xs:annotation>
                    <xs:documentation>Name of first language in second language</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="Other2" type="xs:token" use="required">
                <xs:annotation>
                    <xs:documentation>Name of second language in first language</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="English1" type="xs:token" use="required">
                <xs:annotation>
                    <xs:documentation>Name of first language in English</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="English2" type="xs:token" use="required">
                <xs:annotation>
                    <xs:documentation>Name of second language in English</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="ICO" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>Filename of icon of dictionary (flag combination is recomended for primary dictionary)</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="Name1" type="xs:token" use="required">
                <xs:annotation>
                    <xs:documentation>Name of dictionary in first language</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="Name2" type="xs:token" use="required">
                <xs:annotation>
                    <xs:documentation>Name of dictionary in second language</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="NameE" type="xs:token" use="required">
                <xs:annotation>
                    <xs:documentation>Name of dictionary in English</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="Version" type="version">
                <xs:annotation>
                    <xs:documentation>Version of dictionary</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="Date" type="xs:date">
                <xs:annotation>
                    <xs:documentation>Date of issue of dictionary</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="author">
        <xs:annotation>
            <xs:documentation>Information about author fo this XML file</xs:documentation>
        </xs:annotation>
        <xs:attribute name="nick" type="xs:token" use="required">
            <xs:annotation>
                <xs:documentation>Nick of author of the dictionary</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="FirstName" type="xs:token" use="required">
            <xs:annotation>
                <xs:documentation>First name of author of the dictionary</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="LastName" type="xs:token" use="required">
            <xs:annotation>
                <xs:documentation>Last name of author of the dictionary</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="e-mail" type="xs:token" use="required">
            <xs:annotation>
                <xs:documentation>@-mail of author of the dictionary</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="www" type="xs:anyURI" use="optional">
            <xs:annotation>
                <xs:documentation>Web pages of author of the dictionary</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="note" type="xs:token" use="optional">
            <xs:annotation>
                <xs:documentation>Note to author of dictionary</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="OriginalAuthor">
        <xs:annotation>
            <xs:documentation>Information about author of original dictionary</xs:documentation>
        </xs:annotation>
        <xs:complexContent>
            <xs:extension base="author">
                <xs:attribute name="source" type="xs:token" use="required">
                    <xs:annotation>
                        <xs:documentation>Name of publication (or program or webpage) this dictionary originates from</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:element name="pair" type="pair">
        <xs:annotation>
            <xs:documentation>Translation pair of two words</xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:complexType name="pair">
        <xs:annotation>
            <xs:documentation>Translation pair of two words</xs:documentation>
        </xs:annotation>
        <xs:sequence minOccurs="1" maxOccurs="1">
            <xs:element name="W1" type="word" minOccurs="1" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>Word in first language</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="W2" type="word" minOccurs="1" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>Word in second language</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="rel" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>Word somehow related to current word. The language of current and related words must be the same</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <xs:sequence minOccurs="1" maxOccurs="1">
                        <xs:element ref="relatedword">
                            <xs:annotation>
                                <xs:documentation>
                                    Word related to both (in language 1 and in language 2) words defined in place.
                                    Definition in language 1 will be assigned to word in language 1 and definition in language 2 to word(s) in language 2.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                    <xs:attribute name="rel" type="relation">
                        <xs:annotation>
                            <xs:documentation>type of realtion</xs:documentation>
                        </xs:annotation>
                    </xs:attribute>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="word">
        <xs:sequence minOccurs="1" maxOccurs="1">
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:element name="note" type="xs:token">
                    <xs:annotation>
                        <xs:documentation>Note to current word</xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:sequence>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:element name="rel">
                    <xs:annotation>
                        <xs:documentation>Word somehow related to current word. The language of current and related words must be the same</xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:choice minOccurs="1" maxOccurs="1">
                            <xs:element ref="relw" />
                            <xs:element ref="relatedword" />
                        </xs:choice>
                        <xs:attribute name="rel" type="relation">
                            <xs:annotation>
                                <xs:documentation>type of realtion</xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:sequence>
        <xs:attribute name="N" type="xs:token" use="required">
            <xs:annotation>
                <xs:documentation>Text representing the word in native script</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="L" type="xs:token" use="optional">
            <xs:annotation>
                <xs:documentation>Optional transliteration of word into Latin aplhabet</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="type" type="wordtype" use="optional">
            <xs:annotation>
                <xs:documentation>Gramaticcal type of the word</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:element name="relw">
        <xs:annotation>
            <xs:documentation>Reference to related word</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="word" type="xs:token">
                <xs:annotation>
                    <xs:documentation>Text of related word (in native script)</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="relatedword" type="pair">
        <xs:annotation>
            <xs:documentation>Related word defined in-place</xs:documentation>
        </xs:annotation>
    </xs:element>
    <!--Root element-->
    <xs:element name="Dictionary">
        <xs:annotation>
            <xs:documentation>Root element of dictionary</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence minOccurs="1" maxOccurs="1">
                <xs:element ref="info" />
                <xs:sequence minOccurs="1" maxOccurs="unbounded">
                    <xs:element ref="pair" />
                </xs:sequence>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>